<%@ include file="/common/taglibs.jsp"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>set role right</title>
<link rel="stylesheet" type="text/css"
	href="<c:url value='/styles/${appConfig["csstheme"]}/style.css'/>">
<script src="../js/common.js"></script>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" class="width100">
	<tr>
		<td
			style="width:5px; font-size:0px; line-height:0px; background-color:#A5C331;">&nbsp;</td>
		<td class="right_topbar"><bean:message
			key="user.common.role.name" />&nbsp;&nbsp;<bean:message
			key="button.setting" /></td>
	</tr>
</table>
<bean:define id="roleFuncForm" name="roleFuncForm"
	type="com.sasis.webapp.form.RoleFuncForm" />
<html:form action="roleFuncAction.html">
	<table border="0" cellspacing="0" cellpadding="10" class="width100">
		<tr>
			<td style="padding-bottom:0px; padding-top:5px;">


			<table border="0" cellspacing="0" cellpadding="5"
				class="width100 listable">

				<tr>

					<td width="110" class="leftd"><bean:message
						key="user.common.role.currentname" />:</td>
					<td class="rightd"><bean:write name="roleFuncForm"
						property="urName" /></td>
				</tr>

				<tr>
					<td width="110" class="leftd"><bean:message
						key="user.common.role.selectfunc" />:</td>
					<td class="rightd"><html:select name="roleFuncForm"
						property="flID" size="1">
						<html:options collection="funcInfoList" property="id"
							labelProperty="name" />
					</html:select></td>
				</tr>

			</table>

			<table border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td class="padding10px">&nbsp;</td>
				</tr>
			</table>

			<table border="0" cellspacing="0" cellpadding="10" class="width100">
				<tr>
					<td style="padding-top:0px;"></td>
				</tr>
			</table>
			<table border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td class="but_left">&nbsp;</td>
					<td class="but_mid"><a href="#"
						onclick="javascript:newSubmit('setRef');"><bean:message
						key="button.save" /></a></td>
					<td class="but_right">&nbsp;</td>
					<td class="but_kong">&nbsp;</td>
					<!--  
        <td class="but_left">&nbsp;</td>
        <td class="but_mid"><a href="#" onclick="javascript:submitData();"><bean:message key="button.reset"/></a></td>
        <td class="but_right">&nbsp;</td>
        <td class="but_kong">&nbsp;</td>
        -->

					<td class="but_left">&nbsp;</td>
					<td class="but_mid"><a href="#"
						onclick="javascript:submitData('deleteRef')"><bean:message
						key="button.delete" /></a></td>
					<td class="but_right">&nbsp;</td>
					<td class="but_kong">&nbsp;</td>

					<td class="but_left">&nbsp;</td>
					<td class="but_mid"><a
						href="roleFuncAction.html?method=getAll"><bean:message
						key="button.cancel" /></a></td>
					<td class="but_right">&nbsp;</td>
					<td class="but_kong">&nbsp;</td>
				</tr>
			</table>
			</td>
		</tr>
	</table>

	<table border="0" cellspacing="0" cellpadding="0" class="width100">
		<tr>
			<td class="padding10px">&nbsp;</td>
		</tr>
	</table>

	<table border="0" cellspacing="0" cellpadding="10" class="width100">
		<tr>
			<td style="padding-top:0px;"></td>
		</tr>
	</table>
	<table>
		<tr>

			<td width="110" class="leftd"><font size="2"><b><bean:message
				key="user.common.role.currentfunc" />:</b></font></td>
			<td class="rightd">&nbsp;</td>


		</tr>
	</table>

	<table border="0" cellspacing="0" cellpadding="10" class="width100">
		<tr>
			<td style="padding-top:0px; padding-top:5px;">
			<table border="0" cellspacing="0" cellpadding="2" class="list"
				width="100">

				<tr class="top">
				<tr class="top">
					<td width="40">ID</td>
					<td width="100"><bean:message key="user.common.role.name" /></td>
					<td width="180"><bean:message key="user.common.role.func" /></td>
					<td><bean:message key="user.common.role.desc" /></td>
					<td width="80"><bean:message key="manager.common.func.select" />
					<input type="checkbox" name="allSelect"
						onClick="javascript:checkAll(this.checked);" /></td>
				</tr>

				<logic:notEmpty name="roleFuncInfoList">
					<logic:iterate id="results" name="roleFuncInfoList" indexId="index">
						<tr>
							<td><bean:write name="results" property="ID" /></td>
							<td><bean:write name="results" property="urName" /></td>
							<td><a href="funcAction.html?method=getAll"><bean:write
								name="results" property="flName" /></td>
							<td><bean:write name="results" property="urDescription" />&nbsp;</td>
							<td align="left"><input type="checkbox" name="id"
								value="<bean:write name="results" property="ID"/>" /></td>
						</tr>
					</logic:iterate>
				</logic:notEmpty>
			</table>
			</td>
		</tr>
	</table>
	<table border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td class="padding10px">&nbsp;</td>
		</tr>
	</table>

	<input type="hidden" name="method">
	<html:hidden property="urID" />
	<input type="hidden" name="aryId"
		value="<bean:write name="roleFuncForm" property="urID"/>">
	<input type="hidden" name="refId">
	<input type="hidden" name="message"
		value="<bean:message key="errors.func.select"/>">
</html:form>
<script>
	
	function submitData(method){
	
		var chk = document.forms[0].id;
		var len = chk.length;
		var ary = new Array();
	    //alert(len.lenth);
		document.forms[0].method.value=method;
		if(len>0){
		
		for(var i=0;i<len;i++){
			if(chk[i].checked){
				ary.push(chk[i].value);
			}
		}
		var aryAy = ary; 
		if(aryAy!=0){
		document.forms[0].refId.value = aryAy;
		//alert("len>0 and checked");
		document.forms[0].submit();
		//return;
		}
		}else{
		//alert("len<=0");
		if(chk.checked){
		document.forms[0].refId.value = chk.value;
		document.forms[0].submit();
		return;
		}
	}
	    if(ary.length==0)
		{alert(document.forms[0].message.value);}
		
	}
	
	function newSubmit(method){ 
	    document.forms[0].method.value = method;
	    document.forms[0].submit();
     }
     
     function checkAll(status){
               //alert(status);
               for (var i=0;i < document.forms[0].elements.length; i++){
				var e = document.forms[0].elements[i];
				if (e.name=="id")
					document.forms[0].elements[i].checked=status;
			}
			
		}
     
  
</script>

</body>
</html>
